$(function(){
    var k=$(window).height();
    var flag=false;
    console.log(k);
    $('#fullpage').fullpage({
        navigation:true,
        navigationPosition:'right'//按钮位置
        ,loopBottom:true//滚东到底部后自动到顶部
        ,loopTop:true//跟上面相反
        ,scrollingSpeed:400//滚动速度
        ,afterLoad: function(anchorLink,index) {
            if(index===2&&flag===false){
              $('.search').show().animate({'right':370},1500,function () {
                  $('.search-wrods').animate({'opacity':1},500,function () {
                      $('.search').hide();
                      $('.search02-1').show().animate({'right':250,'bottom':452,'height':30},500,function () {
                          flag=true;
                      });
                      $('.goods-02').show().animate({'height':218},500);
                      $('.words-02').animate({'opacity':1},500)
                  })
              });
            }
        }
        ,onLeave:function (index,nextIndex,direction) {
            if(index===2&&nextIndex===3&&flag===true){
                // console.log(2);
                $('.shirt-02').show().animate({'bottom':-(k-250),'width':207,'left':260},2000,function () {
                    $('.img-01-a').animate({'opacity':1},500,function () {
                        $('.btn-01-a').animate({'opacity':1},20)
                    })
                });
                $('.cover').show();
            }

            if(index===3&&nextIndex===4){
                $(".shirt-02").hide();
                $('.t1f').show().animate({'bottom':-((k-250)+50),left:260},1000,function () {
                    $(this).hide();
                    $('.car-img').show();

                    $('.car').animate({'left':3000},5000,'easeInElastic',function () {

                    });
                });
            }
        }



    })
});